from appium.webdriver.common.appiumby import AppiumBy

from basic.base_assert import current_page
from basic.base_page import BasePage


class PageShopping(BasePage):

    def buy_now(self):
        pass

    def add_to_cart(self):
        加入购物车 = "new UiSelector().text(\"加入购物车\")"
        确定 = "new UiSelector().className(\"android.view.ViewGroup\").instance(51)"
        self._click(加入购物车)
        self._click(确定)
        return self

    def collection(self):
        pass

    def goto_shopping_cart(self):
        购物车 = AppiumBy.XPATH, "//android.widget.TextView[@text=\"购物车\"]"
        self._click(购物车)
        return current_page()


